//
//  BBMyApproveViewController.m
//  2222
//
//  Created by BearBaby on 16/3/25.
//  Copyright © 2016年 BearBaby. All rights reserved.
//

#import "BBMyApproveViewController.h"
#import "BBSixHeader.h"
#import "BBMyApproveTableViewCell.h"
#import "BBMyApproveDetailController.h"
@interface BBMyApproveViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView* tableView;
@property(nonatomic,strong)BBMyApproveDetailController* detailVC;       //审批流程详情
@end

@implementation BBMyApproveViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的审批流程";
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEHEIGHT) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;

}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;

}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        UITableViewCell* cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
        cell.textLabel.text = @"我已审批的流程";
        cell.textLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    }
    
    static NSString* identifire = @"Cell";
    BBMyApproveTableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:identifire];
    
    if (!cell) {
        cell = [[BBMyApproveTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifire];
        cell.delegate = self;
    }
 
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section==0) {
        return 44;
    }else{
    
    CGFloat cellHeight = 0.0f;
    BBMyApproveTableViewCell* cell = (BBMyApproveTableViewCell*)[self tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath];
    cellHeight = cell.finalH;
    return cellHeight;
    }

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        
    }else{
        self.detailVC = [[BBMyApproveDetailController alloc]init];
        [self.navigationController pushViewController:self.detailVC animated:YES];
    
    }


}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{

    return 0.000001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section==1) {
        return 30;
    }else{
        return 15;
    }
    return 30;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    NSString* string = nil;
    if (section==1) {
      string = @"需要我审批的流程(3)";
    }else{
    
    string = @"";
    }
    
    
    return string;
}
@end
